﻿CREATE PROCEDURE [acms].[PostMenu_Delete]
	@PostId int, 
	@MenuId int,
	@VersionId timestamp
AS
	update PostMenu
	set Deleted = 1
	Where PostId = @PostId and MenuId = @MenuID and VersionId = @VersionId and Deleted = 0
	
	if @@RowCount = 0 begin
		if exists (Select null From PostMenu_View where PostId = @PostId and MenuId = @MenuID)
			return -100
		else
			return -200
	end
RETURN 0;